// JavaScript Document
$(document).ready(function(e) {
    $('#slideshow').cycle({
		fx : 'fade',
		speed : 2000,
		timeout: 10000
	});
	
	$('#txt-keyword').focus(function(e) {
        if($(this).val() == 'Tìm kiếm sản phẩm...' || $(this).val() == 'Search product...'){
			$(this).val('')
		}
    });
	
	$('#txt-keyword').focusout(function(e) {
		if($(this).val() == ''){
			$(this).val(default_search);
		}
    });
	
	$('#txt-keyword').keyup(function(e) {
        if(e.keyCode == 13 && $(this).val() != ''){
			window.location.replace('tim-kiem.html-'+$(this).val().replace(/ /g, '+').replace(/"/g, '').replace(/'/g, ''));
		}
    });
	
	$('#men-prod').hover(function(e){
		$('#sub-product-menu').stop().slideDown(300);
	}, function(e){
		$('#sub-product-menu').slideUp(200);
	});
});

$(document).ready(function(e) {
    $('#set-vi').click(function(e) {
        $('#localize').val('vi');
		$('#lan').submit();
    });
	$('#set-en').click(function(e) {
        $('#localize').val('en');
		$('#lan').submit();
    });
});

function checkEmailAddr(email){
	var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}(\.[a-zA-Z]{2,3}){0,1}$/;
	return pattern.test(email);
}










